Skip to content

Commit

Permalink
fix(vue): wait for server start before running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dpellier committed Jul 29, 2024
1 parent a886d34 commit 25232e9
Show file tree
Hide file tree
Showing 18 changed files with 284 additions and 2,131 deletions.
3 changes: 2 additions & 1 deletion packages/ods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"ts-jest": "29.1.2",
"typedoc": "0.25.8",
"typedoc-plugin-markdown": "3.17.1",
"typescript": "5.3.3"
"typescript": "5.3.3",
"wait-on": "7.2.0"
}
}
2 changes: 1 addition & 1 deletion packages/ods/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"compile": "npm run compile:esm && npm run compile:cjs",
"compile:esm": "tsc -p tsconfig.json",
"compile:cjs": "tsc -p tsconfig.cjs.json",
"test:e2e": "concurrently -s first -k \"npm run start --prefix tests/_app\" \"jest -c tests/jest.config.js\"",
"test:e2e": "concurrently -s first -k \"npm run start --prefix tests/_app\" \"wait-on http://localhost:3000 && jest -c tests/jest.config.js\"",
"test:e2e:ci": "npm run test:e2e"
},
"main": "dist/cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/ods/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"compile": "npm run compile:esm && npm run compile:cjs",
"compile:esm": "tsc -p tsconfig.json",
"compile:cjs": "tsc -p tsconfig.cjs.json",
"test:e2e": "concurrently -s first -k \"npm run start --prefix tests/_app\" \"jest -c tests/jest.config.js\"",
"test:e2e": "concurrently -s first -k \"npm run start --prefix tests/_app\" \"wait-on http://localhost:3000 && jest -c tests/jest.config.js\"",
"test:e2e:ci": "npm run test:e2e"
},
"main": "dist/cjs/index.js",
Expand Down
5 changes: 0 additions & 5 deletions packages/ods/vue/tests/_app/babel.config.js

This file was deleted.

12 changes: 12 additions & 0 deletions packages/ods/vue/tests/_app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Vue Test App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
10 changes: 5 additions & 5 deletions packages/ods/vue/tests/_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"name": "ods-components-vue-test-app",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "vue-cli-service serve"
"start": "vite"
},
"dependencies": {
"core-js": "3.36.0",
"vue": "3.4.21",
"vue-router": "4.3.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "5.0.8",
"@vue/cli-plugin-router": "5.0.8",
"@vue/cli-plugin-typescript": "5.0.8",
"@vue/cli-service": "5.0.8"
"@vitejs/plugin-vue": "5.0.4",
"vite": "5.0.10",
"vite-tsconfig-paths": "4.2.3"
}
}
Binary file removed packages/ods/vue/tests/_app/public/favicon.ico
Binary file not shown.
16 changes: 0 additions & 16 deletions packages/ods/vue/tests/_app/public/index.html

This file was deleted.

10 changes: 10 additions & 0 deletions packages/ods/vue/tests/_app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import tsconfigPaths from 'vite-tsconfig-paths'

export default defineConfig({
plugins: [vue(), tsconfigPaths({ root: '.' })],
server: {
port: 3000,
},
})
8 changes: 0 additions & 8 deletions packages/ods/vue/tests/_app/vue.config.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meta } from '@storybook/addon-docs';
import SpecificationsSpinner from '@ovhcloud/ods-components/src/components/spinner/documentation/specifications/specifications-spinner.mdx';

<Meta title="ODS Components/User feedback/Spinner [atom]/Specifications" />
<Meta title="ODS Components/User feedback/Spinner Specifications" />

# Spinner - Design Specifications
----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meta } from '@storybook/addon-docs';
import Usage from '@ovhcloud/ods-components/src/components/spinner/documentation/usage-guidelines/usage.mdx';

<Meta title="ODS Components/User feedback/Spinner [atom]/Usage Guidelines" />
<Meta title="ODS Components/User feedback/Spinner Usage Guidelines" />

# Spinner - Usage Guidelines
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { html } from 'lit-html';
defineCustomElement();

export default {
title: 'ODS Components/User feedback/Spinner [atom]/Demo',
title: 'ODS Components/User feedback/Spinner Demo',
render: (args) => html`
<ods-spinner color="${args.color}"
size="${args.size}">
Expand Down
43 changes: 20 additions & 23 deletions scripts/component-generator/plopfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,29 @@ module.exports = function (plop) {

plop.setGenerator('component', {
description: 'New component',
prompts: [{
prompts: [
// TODO put back if we finally want to expose namespaced components
// type: 'list',
// name: 'prefix',
// message: 'Which kind of component do you want to create?',
// choices: [
// { name: 'ODS component (<ods-___>)', value: '' },
// { name: 'OVH component (<ods-ovh-___>)', value: 'ovh' },
// ],
// TODO do we keep the atomic information?
// }, {
// {
// type: 'list',
// name: 'level',
// message: 'Which atomic stage your component is?',
// choices: ['quark', 'atom', 'molecule', 'meta', 'organism', 'layout', 'meta'],
// }, {
type: 'input',
name: 'name',
message: 'Type the component name using kebab-case, without any "ods-" prefix (ex: text, search-bar, ...):',
validate: function (value) {
if (/.+/.test(value)) {
return true;
}
return 'Component name is required';
// name: 'prefix',
// message: 'Which kind of component do you want to create?',
// choices: [
// { name: 'ODS component (<ods-___>)', value: '' },
// { name: 'OVH component (<ods-ovh-___>)', value: 'ovh' },
// ],
// },
{
type: 'input',
name: 'name',
message: 'Type the component name using kebab-case, without any "ods-" prefix (ex: text, search-bar, ...):',
validate: function (value) {
if (/.+/.test(value)) {
return true;
}
return 'Component name is required';
},
},
}],
],
actions: [
// --- Add the components files
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meta } from '@storybook/addon-docs';
import Specifications{{> ComponentName }} from '@ovhcloud/ods-{{> component-dir}}/src/components/{{ name }}/documentation/specifications/specifications-{{> component-name }}.mdx';

<Meta title="ODS Components/TODO/{{> ComponentName }} [{{ level }}]/Specifications" />
<Meta title="ODS Components/TODO/{{> ComponentName }} Specifications" />

# {{> ComponentName }} - Design Specifications
----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meta } from '@storybook/addon-docs';
import Usage from '@ovhcloud/ods-{{> component-dir}}/src/components/{{ name }}/documentation/usage-guidelines/usage.mdx';

<Meta title="ODS Components/TODO/{{> ComponentName }} [{{ level }}]/Usage Guidelines" />
<Meta title="ODS Components/TODO/{{> ComponentName }} Usage Guidelines" />

# {{> ComponentName }} - Usage Guidelines
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { html } from 'lit-html';
defineCustomElement();

export default {
title: 'ODS Components/TODO/{{> ComponentName }} [{{ level }}]/Demo',
title: 'ODS Components/TODO/{{> ComponentName }} Demo',
render: (args) => html`
<ods-{{> component-name }} dummy="${args.dummy}">
</ods-{{> component-name }}>
Expand Down
Loading

0 comments on commit 25232e9

Please sign in to comment.