swc/node-swc/__tests__/spack/config_test.js
강동윤 2fedf32747
swc_bundler (#943)
swc_bundler:
 - Splitted from spack

swc_ecma_parser:
 - Fix unexpected eof problem which occurs if log level is trace

swc_ecma_transforms:
 - Fix bugs of dce pass

spack:
 - Support cyclic dependencies
2020-08-12 22:18:47 +09:00

23 lines
801 B
JavaScript

const swc = require("../../..");
const path = require('path');
it('should handle multiple entry in spack.config.js', async () => {
const result = await swc.bundle(path.join(__dirname, '../../tests/spack/config/spack.config.js'));
expect(result.a).toBeTruthy();
expect(result.a.code.replace('\n', '')).toBe(`console.log('foo');`);
expect(result.b).toBeTruthy();
expect(result.b.code.replace('\n', '')).toBe(`console.log('bar');`);
});
it('should respect .swcrc', async () => {
const result = await swc.bundle(path.join(__dirname, '../../tests/spack/config-swcrc/spack.config.js'));
expect(result.a).toBeTruthy();
expect(result.a.code).toContain(`require("./common`);
expect(result.b).toBeTruthy();
expect(result.b.code).toContain(`require("./common`);
});