Skip to content

Commit

Permalink
style: lintfix
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Apr 29, 2022
1 parent 0103dc0 commit 231a528
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions tests/specs/builds/output-commonjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createFixture } from '../../utils/create-fixture';
import { pkgroll } from '../../utils/pkgroll';

export default testSuite(({ describe }, nodePath: string) => {
describe('output: commonjs', ({ describe, test }) => {
describe('output: commonjs', ({ test }) => {
test('{ type: commonjs, field: main, srcExt: js, distExt: js }', async () => {
const fixture = await createFixture('./tests/fixture-package');

Expand Down Expand Up @@ -43,19 +43,19 @@ export default testSuite(({ describe }, nodePath: string) => {

test('{ type: commonjs, field: main, srcExt: mjs, distExt: cjs }', async () => {
const fixture = await createFixture('./tests/fixture-package');

await fixture.writeJson('package.json', {
main: './dist/mjs.cjs',
});

const pkgrollProcess = await pkgroll([], { cwd: fixture.path, nodePath });

expect(pkgrollProcess.exitCode).toBe(0);
expect(pkgrollProcess.stderr).toBe('');

const content = await fixture.readFile('dist/mjs.cjs', 'utf8');
expect(content).toMatch('exports.sayHello =');

await fixture.cleanup();
});

Expand Down
36 changes: 18 additions & 18 deletions tests/specs/builds/output-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createFixture } from '../../utils/create-fixture';
import { pkgroll } from '../../utils/pkgroll';

export default testSuite(({ describe }, nodePath: string) => {
describe('output: module', ({ describe, test }) => {
describe('output: module', ({ test }) => {
test('{ type: module, field: main, srcExt: js, distExt: js }', async () => {
const fixture = await createFixture('./tests/fixture-package');

Expand Down Expand Up @@ -43,59 +43,59 @@ export default testSuite(({ describe }, nodePath: string) => {

test('{ type: commonjs, field: module, srcExt: js, distExt: js }', async () => {
const fixture = await createFixture('./tests/fixture-package');

await fixture.writeJson('package.json', {
module: './dist/index.js',
});

const pkgrollProcess = await pkgroll([], { cwd: fixture.path, nodePath });

expect(pkgrollProcess.exitCode).toBe(0);
expect(pkgrollProcess.stderr).toBe('');

const content = await fixture.readFile('dist/index.js', 'utf8');
expect(content).toMatch('export { index as default }');

await fixture.cleanup();
});

test('{ type: commonjs, field: main, srcExt: cjs, distExt: mjs }', async () => {
const fixture = await createFixture('./tests/fixture-package');

await fixture.writeJson('package.json', {
main: './dist/cjs.mjs',
});

const pkgrollProcess = await pkgroll([], { cwd: fixture.path, nodePath });

expect(pkgrollProcess.exitCode).toBe(0);
expect(pkgrollProcess.stderr).toBe('');

const content = await fixture.readFile('dist/cjs.mjs', 'utf8');
expect(content).toMatch('export { cjs as default }');

await fixture.cleanup();
});

test('require() works in esm', async () => {
const fixture = await createFixture('./tests/fixture-package');

await fixture.writeJson('package.json', {
main: './dist/require.js',
module: './dist/require.mjs',
});

const pkgrollProcess = await pkgroll(['--minify'], { cwd: fixture.path, nodePath });

expect(pkgrollProcess.exitCode).toBe(0);
expect(pkgrollProcess.stderr).toBe('');

const js = await fixture.readFile('dist/require.js', 'utf8');
expect(js).not.toMatch('createRequire');

const mjs = await fixture.readFile('dist/require.mjs', 'utf8');
expect(mjs).toMatch('createRequire');

await fixture.cleanup();
});
});
Expand Down

0 comments on commit 231a528

Please sign in to comment.