mirror of
https://github.com/swc-project/swc.git
synced 2024-12-03 00:54:25 +03:00
24 lines
569 B
JavaScript
24 lines
569 B
JavaScript
const swc = require('../../../');
|
|
|
|
it('should perform dce', () => {
|
|
const out = swc.transformSync(`if (__DEBUG__) {
|
|
console.log('Foo')
|
|
}`, {
|
|
jsc: {
|
|
transform: {
|
|
optimizer: {
|
|
simplify: true,
|
|
globals: {
|
|
vars: {
|
|
__DEBUG__: 'true'
|
|
},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
expect(out.map).toBeFalsy();
|
|
|
|
expect(out.code.trim()).toBe(`console.log("Foo");`);
|
|
}); |