Skip to content

Commit

Permalink
chore: remove windows skip
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jul 28, 2021
1 parent 08107f7 commit a9d879d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
os: [windows-latest]
node: [14, 16]
fail-fast: true
steps:
Expand Down
55 changes: 34 additions & 21 deletions test/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,51 @@

const { expect } = require('../utils/chai')
const execa = require('execa')
const process = require('process')
const { copy, existsSync } = require('fs-extra')
const { join } = require('path')
const fs = require('fs')
const os = require('os')
const { join, normalize } = require('path')
const bin = require.resolve('../')
const tempy = require('tempy')

describe('build', () => {
if (process.platform !== 'win32') {
describe('esm', () => {
let projectDir = ''
describe('esm', () => {
let projectDir = ''

before(async () => {
projectDir = tempy.directory()
before(async () => {
projectDir = `${os.tmpdir()}/${Date.now()}`

await copy(join(__dirname, 'fixtures', 'esm', 'an-esm-project'), projectDir)
})
await copy(join(__dirname, 'fixtures', 'esm', 'an-esm-project'), projectDir)
})

after(async () => {
await fs.promises.rm(projectDir, { recursive: true })
})

it('should build an esm project', async function () {
this.timeout(20 * 1000) // slow ci is slow

it('should build an esm project', async function () {
this.timeout(20 * 1000) // slow ci is slow
// eslint-disable-next-line
console.log('dir', projectDir)
// eslint-disable-next-line
console.log('bin', bin, )

await execa(bin, ['build'], {
cwd: projectDir
try {
await execa('node', [bin, 'build'], {
cwd: normalize(projectDir),
windowsVerbatimArguments: true
})
} catch (err) {
// eslint-disable-next-line
console.log('err', err)
}

expect(existsSync(join(projectDir, 'dist', 'esm'))).to.be.true()
expect(existsSync(join(projectDir, 'dist', 'cjs'))).to.be.true()
expect(existsSync(join(projectDir, 'dist', 'esm'))).to.be.true()
expect(existsSync(join(projectDir, 'dist', 'cjs'))).to.be.true()

const module = require(join(projectDir, 'dist'))
const module = require(join(projectDir, 'dist'))

expect(module).to.have.property('useHerp').that.is.a('function')
expect(module).to.have.property('useDerp').that.is.a('function')
})
expect(module).to.have.property('useHerp').that.is.a('function')
expect(module).to.have.property('useDerp').that.is.a('function')
})
}
})
})

0 comments on commit a9d879d

Please sign in to comment.