| 1 |
import { transform } from "@babel/core"; |
| 2 |
import preset from "../.."; |
| 3 |
|
| 4 |
const CONFIG = { |
| 5 |
babelrc: false, |
| 6 |
configFile: false, |
| 7 |
sourceMap: false, |
| 8 |
compact: true, |
| 9 |
presets: [preset], |
| 10 |
}; |
| 11 |
|
| 12 |
function babel(code) { |
| 13 |
return transform(code, CONFIG).code; |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
describe("Safari await negation", () => { |
| 18 |
it("should ignore non-affected statements", () => { |
| 19 |
expect(babel(`async()=>await 1;`, CONFIG)).toEqual(`async()=>await 1;`); |
| 20 |
}); |
| 21 |
|
| 22 |
it("should wrap negated await statements in parens", () => { |
| 23 |
expect(babel(`async()=>!await 1;`, CONFIG)).toEqual(`async()=>!(await 1);`); |
| 24 |
}); |
| 25 |
}); |