Skip to content

Commit

Permalink
Merge pull request #17 from Roozenboom/replace-pretty-quick-with-lint…
Browse files Browse the repository at this point in the history
…-staged

Replace pretty quick with lint staged
  • Loading branch information
Roozenboom authored Dec 15, 2023
2 parents 3aae0bf + a889c9b commit 66fd433
Show file tree
Hide file tree
Showing 19 changed files with 783 additions and 330 deletions.
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
. "$(dirname -- "$0")/_/husky.sh"

echo
echo "\033[1mRuns Prettier on your changed files\033[0m"
npx pretty-quick --staged
echo "\033[1mRuns lint-staged on your changed files\033[0m"
npx lint-staged --allow-empty
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{ts,js,json,md}": "prettier --write"
}
14 changes: 7 additions & 7 deletions e2e/webdriverio-e2e/tests/defaults.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('webdriverio e2e - defaults', () => {

await runCommandAsync(`npm install --dev @nx/react@latest`);
await runNxCommandAsync(
`generate @nx/react:app ${project} --directory=apps/${project} --projectNameAndRootFormat=as-provided --e2eTestRunner=none --linter=eslint --bundler vite`
`generate @nx/react:app ${project} --directory=apps/${project} --projectNameAndRootFormat=as-provided --e2eTestRunner=none --linter=eslint --bundler vite`,
);
}, 100000);

Expand Down Expand Up @@ -49,7 +49,7 @@ describe('webdriverio e2e - defaults', () => {
const projectJsonPath = joinPathFragments(
'apps',
e2eProject,
'project.json'
'project.json',
);

expect(() => checkFilesExist(projectJsonPath)).not.toThrow();
Expand All @@ -60,28 +60,28 @@ describe('webdriverio e2e - defaults', () => {
const wdioConfigPath = joinPathFragments(
'apps',
e2eProject,
'wdio.config.ts'
'wdio.config.ts',
);
expect(projectJson.targets.e2e.options.wdioConfig).toBe(wdioConfigPath);
expect(() => checkFilesExist(wdioConfigPath)).not.toThrow();

const tsConfigJsonPath = joinPathFragments(
'apps',
e2eProject,
'tsconfig.json'
'tsconfig.json',
);
expect(() => checkFilesExist(tsConfigJsonPath)).not.toThrow();
const tsConfigJson = readJson(tsConfigJsonPath);
expect(
tsConfigJson.compilerOptions.types.includes('@wdio/globals/types')
tsConfigJson.compilerOptions.types.includes('@wdio/globals/types'),
).toBeTruthy();
expect(
tsConfigJson.compilerOptions.types.includes('@wdio/jasmine-framework')
tsConfigJson.compilerOptions.types.includes('@wdio/jasmine-framework'),
).toBeTruthy();

const result = await runNxCommandAsync(`e2e ${e2eProject} --headless`);
expect(result.stdout).toContain(
`Successfully ran target e2e for project ${e2eProject}`
`Successfully ran target e2e for project ${e2eProject}`,
);
}, 60000);
});
18 changes: 9 additions & 9 deletions e2e/webdriverio-e2e/tests/devtools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('webdriverio e2e - mocha, devtools and localhost', () => {
ensureNxProject('@rbnx/webdriverio', 'dist/packages/webdriverio');
await runCommandAsync(`npm install --dev @nx/react@latest`);
await runNxCommandAsync(
`generate @nx/react:app ${project} --directory=apps/${project} --projectNameAndRootFormat=as-provided --e2eTestRunner=none --linter=eslint --bundler vite`
`generate @nx/react:app ${project} --directory=apps/${project} --projectNameAndRootFormat=as-provided --e2eTestRunner=none --linter=eslint --bundler vite`,
);
}, 100000);

Expand All @@ -30,7 +30,7 @@ describe('webdriverio e2e - mocha, devtools and localhost', () => {

it('should create an e2e project with mocha and devtools protocol', async () => {
await runNxCommandAsync(
`generate @rbnx/webdriverio:project ${project} --framework=mocha --protocol=devtools`
`generate @rbnx/webdriverio:project ${project} --framework=mocha --protocol=devtools`,
);

expect(() => checkFilesExist('package.json')).not.toThrow();
Expand All @@ -44,15 +44,15 @@ describe('webdriverio e2e - mocha, devtools and localhost', () => {
const tsConfigJsonPath = joinPathFragments(
'apps',
e2eProject,
'tsconfig.json'
'tsconfig.json',
);
expect(() => checkFilesExist(tsConfigJsonPath)).not.toThrow();
const tsConfigJson = readJson(tsConfigJsonPath);
expect(
tsConfigJson.compilerOptions.types.includes('@wdio/mocha-framework')
tsConfigJson.compilerOptions.types.includes('@wdio/mocha-framework'),
).toBeTruthy();
expect(
tsConfigJson.compilerOptions.types.includes('@wdio/devtools-service')
tsConfigJson.compilerOptions.types.includes('@wdio/devtools-service'),
).toBeTruthy();
}, 60000);

Expand All @@ -62,7 +62,7 @@ describe('webdriverio e2e - mocha, devtools and localhost', () => {
e2eProject,
'src',
'e2e',
'app.spec.ts'
'app.spec.ts',
);

expect(() => checkFilesExist(appSpecFilePath)).not.toThrow();
Expand All @@ -75,14 +75,14 @@ describe('webdriverio e2e - mocha, devtools and localhost', () => {
await expect(browser).toHaveTitle('${projectNames.className}');
});
});
`
`,
);

const result = await runNxCommandAsync(
`e2e ${e2eProject} --devServerTarget="${project}:serve:development"`
`e2e ${e2eProject} --devServerTarget="${project}:serve:development"`,
);
expect(result.stdout).toContain(
`Successfully ran target e2e for project ${e2eProject}`
`Successfully ran target e2e for project ${e2eProject}`,
);
}, 60000);
});
Loading

0 comments on commit 66fd433

Please sign in to comment.