Skip to content

Commit

Permalink
Lints
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Sep 27, 2024
1 parent cdbc755 commit 6e3508b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 65 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default [
{
files: [
'files/*/app/**/*.js',
'files-override/**/*.mjs',
'files-override/*/app/**/*.js',
'files-override/*/tests/**/*.js',
],
Expand Down
32 changes: 16 additions & 16 deletions files-override/shared/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vite';
import { defineConfig } from "vite";
import {
resolver,
hbs,
Expand All @@ -8,18 +8,18 @@ import {
compatPrebuild,
assets,
contentFor,
} from '@embroider/vite';
import { babel } from '@rollup/plugin-babel';
} from "@embroider/vite";
import { babel } from "@rollup/plugin-babel";

const extensions = [
'.mjs',
'.gjs',
'.js',
'.mts',
'.gts',
'.ts',
'.hbs',
'.json',
".mjs",
".gjs",
".js",
".mts",
".gts",
".ts",
".hbs",
".json",
];

export default defineConfig(({ mode }) => {
Expand All @@ -37,7 +37,7 @@ export default defineConfig(({ mode }) => {
contentFor(),

babel({
babelHelpers: 'runtime',
babelHelpers: "runtime",
extensions,
}),
],
Expand All @@ -46,12 +46,12 @@ export default defineConfig(({ mode }) => {
port: 4200,
},
build: {
outDir: 'dist',
outDir: "dist",
rollupOptions: {
input: {
main: 'index.html',
main: "index.html",
...(shouldBuildTests(mode)
? { tests: 'tests/index.html' }
? { tests: "tests/index.html" }
: undefined),
},
},
Expand All @@ -60,5 +60,5 @@ export default defineConfig(({ mode }) => {
});

function shouldBuildTests(mode) {
return mode !== 'production' || process.env.FORCE_BUILD_TESTS;
return mode !== "production" || process.env.FORCE_BUILD_TESTS;
}
56 changes: 7 additions & 49 deletions tests/typescript.test.mjs
Original file line number Diff line number Diff line change
@@ -1,65 +1,23 @@
import { describe, it, beforeAll, afterAll, expect } from 'vitest';
import { describe, it, expect } from 'vitest';
import { join } from 'path';
import tmp from 'tmp-promise';
import { execa } from 'execa';
import copyWithTemplate from '../lib/copy-with-template';
import { existsSync } from 'fs';

const blueprintPath = join(__dirname, '..');
const appName = 'fancy-app-in-test';
import { newProjectWithFixtures } from './helpers.mjs';

describe('typescript', function () {
let tmpDir;
let emberCli = `[email protected]`;

beforeAll(async () => {
tmpDir = await tmp.dir({ unsafeCleanup: true });

let emberCliArgs = [
emberCli,
'new',
appName,
'-b',
blueprintPath,
'--pnpm',
'--skip-git',
'--typescript',
];

await execa('npx', emberCliArgs, {
cwd: tmpDir.path,
preferLocal: true,
});

// apply the fixture on top of the generated app
copyWithTemplate(
join(__dirname, 'fixture-ts'),
join(tmpDir.path, appName),
{
name: appName,
},
);
});

afterAll(async () => {
try {
await tmpDir.cleanup();
} catch {
// if it fails to cleaup we don't want to break CI
}
let project = newProjectWithFixtures({
fixturePath: join(__dirname, 'fixture-ts'),
flags: ['--typescript'],
});

it('verify files', async function () {
expect(
existsSync(join(tmpDir.path, 'tsconfig.json')),
existsSync(join(project.dir(), 'tsconfig.json')),
'the root tsconfig.json has been added',
);
});

it('glint passes', async function () {
let result = await execa('pnpm', ['glint'], {
cwd: join(tmpDir.path, appName),
});
let result = await project.execa('pnpm', ['glint']);

console.log(result.stdout);
});
Expand Down

0 comments on commit 6e3508b

Please sign in to comment.