2020-06-12 20:05:49 +03:00
|
|
|
const swc = require('../../../');
|
|
|
|
|
2022-04-11 21:45:58 +03:00
|
|
|
it('should work without parser.syntax', () => {
|
2020-06-12 20:05:49 +03:00
|
|
|
const out = swc.transformSync(`const someValue = "test" ?? "default value";`, {
|
|
|
|
jsc: {
|
|
|
|
parser: {
|
|
|
|
nullishCoalescing: true,
|
|
|
|
numericSeparator: true
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
expect(out.map).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should work with parser.syntax', () => {
|
|
|
|
const out = swc.transformSync(`const someValue = "test" ?? "default value";`, {
|
|
|
|
jsc: {
|
|
|
|
parser: {
|
|
|
|
syntax: 'ecmascript',
|
|
|
|
nullishCoalescing: true,
|
|
|
|
numericSeparator: true
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
expect(out.map).toBeFalsy();
|
2022-04-11 21:45:58 +03:00
|
|
|
});
|