mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 02:06:08 +03:00
3a372ad29a
The commit will help - Better testing - Preventing regression like #785. - **Implementing spack** (It requires access to neon api because of the plugin system)
23 lines
533 B
JavaScript
23 lines
533 B
JavaScript
const swc = require('../../../');
|
|
|
|
it('should perform dce', () => {
|
|
const out = swc.transformSync(`if (__DEBUG__) {
|
|
console.log('Foo')
|
|
}`, {
|
|
jsc: {
|
|
transform: {
|
|
optimizer: {
|
|
globals: {
|
|
vars: {
|
|
__DEBUG__: 'true'
|
|
},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
expect(out.map).toBeFalsy();
|
|
|
|
expect(out.code.trim()).toBe(`console.log('Foo');`);
|
|
}); |