Skip to content

Commit

Permalink
chore: fix version lookup in integration test (netlify/edge-bundler#143)
Browse files Browse the repository at this point in the history
* chore: fix version lookup in integration test

* chore: use `require`
  • Loading branch information
eduardoboucas authored Sep 30, 2022
1 parent 35662aa commit 595ac18
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/edge-bundler/test/integration/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from 'assert'
import childProcess from 'child_process'
import { promises as fs } from 'fs'
import { createRequire } from 'module'
import { join, resolve } from 'path'
import process from 'process'
Expand All @@ -17,17 +18,20 @@ const functionsDir = resolve(fileURLToPath(import.meta.url), '..', 'functions')
const pathsToCleanup = new Set()

const installPackage = async () => {
console.log(`Getting package version from 'npm info'...`)
console.log(`Getting package version...`)

const { name, version } = require('../../package.json')

console.log(`Running integration tests for ${name} v${version}...`)

const { stdout: infoOutput } = await exec('npm info --json')
const { version } = JSON.parse(infoOutput)
const { path } = await tmp.dir()

console.log(`Creating tarball with 'npm pack'...`)

await exec('npm pack --json')

const filename = join(process.cwd(), `netlify-edge-bundler-${version}.tgz`)
const normalizedName = name.replace(/@/, '').replace(/\W/g, '-')
const filename = join(process.cwd(), `${normalizedName}-${version}.tgz`)

console.log(`Uncompressing the tarball at '${filename}'...`)

Expand Down

0 comments on commit 595ac18

Please sign in to comment.