import * as t from 'node:assert/strict';
import { outdent } from 'outdent';
import { describe, it } from 'vitest';
import { parseSource } from '../../../src/parser';
import { fail, pass } from '../../test-utils';

describe('Next - Decorators', () => {
  for (const arg of [
    'var foo = @dec class Bar { bam() { f(); } }',
    'class A { @dec *m(){} }',
    'class A { @a.b.c.d(e, f)     m(){}}',
    'class Bar{ @outer( @classDec class { @inner innerMethod() {} } ) outerMethod() {} }',
    '@(foo().bar) class Foo { @(member[expression]) method() {} @(foo + bar) method2() {} }',
    outdent`
      @foo('bar')
      class Foo {}
    `,
    '(class A { @foo get getter(){} })',
    'class A { @foo get getter(){} }',
    'class A { @foo set setter(bar){} }',
    'class A { @foo async bar(){} }', // allowed?
    '@foo class Foo {}',
    outdent`
      @outer({
        store: @inner class Foo {}
      })
      class Bar {
      }
    `,
    outdent`
      @({
        store: @inner class Foo {}
      })
      class Bar {
      }
    `,
    outdent`
      @foo(@bar class Bar{})
      class Foo {}
    `,
    'class Foo { @foo @bar bar() {} }',
    'class Foo { @foo bar() {} }',
    'var foo = class Bar { @foo Zoo() {} }',
    outdent`
      @foo('bar')
      class Foo {}
    `,
    '@abc class Foo {}',
    outdent`
      class A {
        @dec *m(){}
      }
    `,
    outdent`
      (class A {
        @dec *m(){}
      })
    `,
    outdent`
      class A {
import { defineConfig } from 'vitest/config';

const IS_CI = Boolean(process.env.CI);
const SHOULD_RUN_PRODUCTION_TEST = IS_CI || Boolean(process.env.PRODUCTION_TEST);
const SHOULD_RUN_TEST262 = IS_CI || Boolean(process.env.SHOULD_RUN_TEST262) || Boolean(process.env.TEST262_FILE);

export default defineConfig({
  test: {
    include: ['test/**/*.ts'],
    exclude: [
      'test/test-utils.ts',
      // Skip production test on local by default
      ...(SHOULD_RUN_PRODUCTION_TEST ? [] : ['test/production/production-tests.ts']),
      // Skip test 262 on local by default
      ...(SHOULD_RUN_TEST262
        ? []
        : ['test/test262-parser-tests/parser-tests.ts', 'test/test262-parser-tests/ast-alignment-test.ts']),
    ],
    watch: false,
    coverage: {
      enabled: IS_CI,
      provider: 'v8',
      reporter: ['lcov', 'text', 'html'],
      include: ['src/**/*.ts'],
    },
  },
});
