Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-initialize Vue #506

Merged
merged 5 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 17 additions & 22 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
/* eslint-env node */
require("@rushstack/eslint-patch/modern-module-resolution");
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
extends: [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/eslint-config-typescript/recommended",
"@vue/eslint-config-prettier",
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
env: {
"vue/setup-compiler-macros": true,
},
overrides: [
{
files: ["cypress/integration/**.spec.{js,ts,jsx,tsx}"],
extends: ["plugin:cypress/recommended"],
},
files: [
'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'
],
'extends': [
'plugin:cypress/recommended'
]
}
],
rules: {
"no-empty": 0,
"no-constant-condition": 0,
"@typescript-eslint/no-empty-function": 0,
"no-case-declarations": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/ban-ts-comment": 0,
},
};
parserOptions: {
ecmaVersion: 'latest'
}
}
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
8 changes: 7 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin", "ZixuanChen.vitest-explorer"]
"recommendations": [
"Vue.volar",
"Vue.vscode-typescript-vue-plugin",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ZixuanChen.vitest-explorer"
]
}
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,18 @@ npm run test:unit
### Run End-to-End Tests with [Cypress](https://www.cypress.io/)

```sh
npm run build
npm run test:e2e # or `npm run test:e2e:ci` for headless testing
npm run test:e2e:dev
```

Please note that `cypress` expects the base URL to be `"/"`. Modify your local `vite.config.ts` accordingly before running e2e tests.
This runs the end-to-end tests against the Vite development server.
It is much faster than the production build.

But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments):

```sh
npm run build
npm run test:e2e
```

### Lint with [ESLint](https://eslint.org/)

Expand Down
8 changes: 8 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'cypress'

export default defineConfig({
e2e: {
specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:4173'
}
})
3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

22 changes: 22 additions & 0 deletions cypress/e2e/basic.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// https://on.cypress.io/api

describe("Basic test", () => {
it("visits the app root url", () => {
cy.visit("/");
cy.contains("h2", "Scale data");
});
});

describe("404 page", () => {
it("creates an octaplex", () => {
cy.visit("/non-existing-page");
cy.contains("h2", "Not found");
cy.get("a").last().click();
cy.get("button").first().click();
cy.contains("h2", "Scale data");
cy.get("#scale-name").should(
"have.value",
"The Octaplex (3 5 7 11)"
);
});
});
4 changes: 2 additions & 2 deletions cypress/tsconfig.json → cypress/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["./integration/**/*", "./support/**/*"],
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["./**/*", "../support/**/*"],
"compilerOptions": {
"isolatedModules": false,
"target": "es5",
Expand Down
30 changes: 0 additions & 30 deletions cypress/integration/basic.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions cypress/plugins/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions cypress/plugins/tsconfig.json

This file was deleted.

16 changes: 15 additions & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.js shows you how to
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
Expand All @@ -23,3 +24,16 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

export {}
2 changes: 1 addition & 1 deletion cypress/support/index.ts → cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Loading