flecks/packages/build/test/e2e/lint.js
2024-02-14 20:16:31 -06:00

51 lines
1.2 KiB
JavaScript

import {processCode, spawnWith} from '@flecks/core/server';
import {expect} from 'chai';
it('can lint', async () => {
expect(
await processCode(await spawnWith(
['npx', 'eslint', '--config', 'build/eslint.config.js', 'test/lint/fine.js'],
{
env: {
FLECKS_BUILD_ESLINT_NO_CACHE: true,
FLECKS_BUILD_TESTING_LINT: true,
},
},
)),
)
.to.equal(0);
});
it('can fail to lint', async () => {
expect(
await processCode(await spawnWith(
['npx', 'eslint', '--config', 'build/eslint.config.js', 'test/lint/fail.js'],
{
env: {
FLECKS_BUILD_ESLINT_NO_CACHE: true,
FLECKS_BUILD_TESTING_LINT: true,
},
stdio: 'ignore',
},
)),
)
.to.not.equal(0);
});
it('can override lint', async () => {
expect(
await processCode(await spawnWith(
['npx', 'eslint', '--config', 'build/eslint.config.js', 'test/lint/fine.js'],
{
env: {
FLECKS_BUILD_ESLINT_NO_CACHE: true,
FLECKS_BUILD_TESTING_LINT: true,
FLECKS_CORE_ROOT: 'test/lint/root',
},
stdio: 'ignore',
},
)),
)
.to.not.equal(0);
});