Skip to content

Commit

Permalink
chore: skip windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jul 22, 2021
1 parent 4da04bc commit 0a3aa0a
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions test/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,43 @@

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

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

before(async () => {
projectDir = tempy.directory()
before(async () => {
projectDir = tempy.directory()

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

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

await execa(bin, ['build'], {
cwd: projectDir
})
await execa(bin, ['build'], {
cwd: projectDir
})

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')

const distPkgPath = join(projectDir, 'dist', 'package.json')
const distPkg = await readJson(distPkgPath)
const distPkgPath = join(projectDir, 'dist', 'package.json')
const distPkg = await readJson(distPkgPath)

expect(distPkg.types.includes('dist')).to.be.false()
expect(distPkg.types.includes('dist')).to.be.false()
})
})
})
}
})

0 comments on commit 0a3aa0a

Please sign in to comment.