Debian Codegraph @

packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-runtime-errors--to-es2015/invalid-add-initializer/exec.js

raw
1 const decWithInitializer = (init) => (_, context) => { context.addInitializer(init) }
2
3 expect(() => class { @decWithInitializer(null) static m() {} }).toThrow("An initializer must be a function")
4 expect(() => class { @decWithInitializer(false) static m() {} }).toThrow("An initializer must be a function")
5 expect(() => class { @decWithInitializer(void 0) static m() {} }).toThrow("An initializer must be a function");
6 expect(() => class { @decWithInitializer(() => {}) static m() {} }).not.toThrow();