Skip to content

Commit 7399d37

Browse files
authored
Merge pull request #2064 from usablica/restructure
Restructure the project and public APIs
2 parents b51910f + 772bc40 commit 7399d37

File tree

150 files changed

+6249
-4700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+6249
-4700
lines changed

Diff for: .github/workflows/nodejs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
uses: actions/setup-node@v1
1818
with:
1919
node-version: ${{ matrix.node-version }}
20-
- run: npm install
20+
- run: npm ci
2121
- run: npm run build
22-
- run: npm test
22+
- run: npm run test
2323
env:
2424
CI: true

Diff for: .gitignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dist/
3737
.changelog
3838

3939
# Tests
40-
tests/cypress/setup/dist
41-
tests/cypress/videos/
42-
tests/cypress/snapshots/actual
43-
tests/cypress/snapshots/diff
40+
cypress/setup/dist
41+
cypress/videos/
42+
cypress/snapshots/actual
43+
cypress/snapshots/diff

Diff for: cypress.config.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defineConfig } from "cypress";
2+
import { configureVisualRegression } from "cypress-visual-regression";
3+
4+
module.exports = defineConfig({
5+
trashAssetsBeforeRuns: true,
6+
env: {
7+
failSilently: false,
8+
},
9+
e2e: {
10+
screenshotsFolder: "./cypress/snapshots/actual",
11+
supportFile: "./cypress/support/index.ts",
12+
specPattern: "**/*.*cy.*",
13+
setupNodeEvents(on, config) {
14+
configureVisualRegression(on);
15+
16+
return config;
17+
},
18+
},
19+
});

Diff for: cypress/plugins/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = (on, config) => {
2+
const getCompareSnapshotsPlugin = require("cypress-visual-regression/dist/plugin");
3+
getCompareSnapshotsPlugin(on, config);
4+
};

Diff for: tests/cypress/setup/index.html renamed to cypress/setup/index.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
crossorigin="anonymous"
1515
/>
1616

17-
<link href="./dist/introjs.css" rel="stylesheet" />
17+
<link href="http://localhost:10001/dist/introjs.css" rel="stylesheet" />
18+
<link href="http://host.docker.internal:10001/dist/introjs.css" rel="stylesheet" />
1819

1920
<link rel="preconnect" href="https://fonts.gstatic.com" />
2021
<link
@@ -156,7 +157,7 @@ <h2 data-intro="fourth header step" data-hint="secondary header">
156157
class="pt-3 mt-4 text-muted border-top"
157158
data-hint="this is the footer"
158159
>
159-
&copy; 2021
160+
&copy; YEAR
160161
</footer>
161162
</div>
162163
</main>
@@ -178,6 +179,7 @@ <h2 data-intro="fourth header step" data-hint="secondary header">
178179
console.log(3);
179180
};
180181
</script>
181-
<script type="text/javascript" src="./dist/intro.js"></script>
182+
<script type="text/javascript" src="http://localhost:10001/dist/intro.js"></script>
183+
<script type="text/javascript" src="http://host.docker.internal:10001/dist/intro.js"></script>
182184
</body>
183185
</html>
Loading
Loading
Loading
Loading
Loading
Loading
130 KB
Loading
Loading
Loading
Loading

Diff for: cypress/support/index.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
declare namespace Cypress {
3+
interface Chainable<Subject = any>{
4+
nextStep(): Chainable<any>;
5+
prevStep(): Chainable<any>;
6+
}
7+
interface Window {
8+
introJs: any;
9+
click: () => void;
10+
clickRelative: () => void;
11+
clickAbsolute: () => void;
12+
}
13+
}

Diff for: cypress/support/index.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/// <reference types="./index.d.ts" />
2+
3+
import { addCompareSnapshotCommand } from "cypress-visual-regression/dist/command";
4+
5+
addCompareSnapshotCommand({
6+
capture: "fullPage",
7+
});
8+
9+
Cypress.Commands.add("nextStep", () => {
10+
cy.get(".introjs-nextbutton").click();
11+
});
12+
13+
Cypress.Commands.add("prevStep", () => {
14+
cy.get(".introjs-prevbutton").click();
15+
});
16+
17+
Cypress.on("window:before:load", (win) => {
18+
const htmlNode = win.document.querySelector("html");
19+
const node = win.document.createElement("style");
20+
node.innerHTML = "html { scroll-behavior: inherit !important; }";
21+
htmlNode?.appendChild(node);
22+
});
23+
24+
import "cypress-real-events/support";

Diff for: jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
testEnvironment: 'node',
33
clearMocks: true,
44
setupFilesAfterEnv: ["jest-extended/all"],
5-
roots: ["<rootDir>/tests/jest"],
5+
roots: ["<rootDir>/tests/jest", "<rootDir>/src"],
66
transform: {
77
'^.+\\.tsx?$': ['ts-jest', {
88
...require('./tsconfig.test.json')
@@ -17,6 +17,7 @@ module.exports = {
1717
coverageDirectory: 'coverage',
1818
collectCoverageFrom: [
1919
'src/**/*.{ts,tsx,js,jsx}',
20+
'!src/**/*.cy.ts',
2021
'!src/**/*.d.ts',
2122
'!src/**/*.test.ts',
2223
],

0 commit comments

Comments
 (0)