|
3 | 3 |
|
4 | 4 | const { expect } = require('../utils/chai') |
5 | 5 | const execa = require('execa') |
| 6 | +const process = require('process') |
6 | 7 | const { copy, existsSync, readJson } = require('fs-extra') |
7 | 8 | const { join } = require('path') |
8 | 9 | const bin = require.resolve('../') |
9 | 10 | const tempy = require('tempy') |
10 | 11 |
|
11 | 12 | describe('build', () => { |
12 | | - describe('esm', () => { |
13 | | - let projectDir = '' |
| 13 | + if (process.platform !== 'win32') { |
| 14 | + describe('esm', () => { |
| 15 | + let projectDir = '' |
14 | 16 |
|
15 | | - before(async () => { |
16 | | - projectDir = tempy.directory() |
| 17 | + before(async () => { |
| 18 | + projectDir = tempy.directory() |
17 | 19 |
|
18 | | - await copy(join(__dirname, 'fixtures', 'esm', 'an-esm-project'), projectDir) |
19 | | - }) |
| 20 | + await copy(join(__dirname, 'fixtures', 'esm', 'an-esm-project'), projectDir) |
| 21 | + }) |
20 | 22 |
|
21 | | - it('should build an esm project', async function () { |
22 | | - this.timeout(20 * 1000) // slow ci is slow |
| 23 | + it('should build an esm project', async function () { |
| 24 | + this.timeout(20 * 1000) // slow ci is slow |
23 | 25 |
|
24 | | - await execa(bin, ['build'], { |
25 | | - cwd: projectDir |
26 | | - }) |
| 26 | + await execa(bin, ['build'], { |
| 27 | + cwd: projectDir |
| 28 | + }) |
27 | 29 |
|
28 | | - expect(existsSync(join(projectDir, 'dist', 'esm'))).to.be.true() |
29 | | - expect(existsSync(join(projectDir, 'dist', 'cjs'))).to.be.true() |
| 30 | + expect(existsSync(join(projectDir, 'dist', 'esm'))).to.be.true() |
| 31 | + expect(existsSync(join(projectDir, 'dist', 'cjs'))).to.be.true() |
30 | 32 |
|
31 | | - const module = require(join(projectDir, 'dist')) |
| 33 | + const module = require(join(projectDir, 'dist')) |
32 | 34 |
|
33 | | - expect(module).to.have.property('useHerp').that.is.a('function') |
34 | | - expect(module).to.have.property('useDerp').that.is.a('function') |
| 35 | + expect(module).to.have.property('useHerp').that.is.a('function') |
| 36 | + expect(module).to.have.property('useDerp').that.is.a('function') |
35 | 37 |
|
36 | | - const distPkgPath = join(projectDir, 'dist', 'package.json') |
37 | | - const distPkg = await readJson(distPkgPath) |
| 38 | + const distPkgPath = join(projectDir, 'dist', 'package.json') |
| 39 | + const distPkg = await readJson(distPkgPath) |
38 | 40 |
|
39 | | - expect(distPkg.types.includes('dist')).to.be.false() |
| 41 | + expect(distPkg.types.includes('dist')).to.be.false() |
| 42 | + }) |
40 | 43 | }) |
41 | | - }) |
| 44 | + } |
42 | 45 | }) |
0 commit comments