cypress-ct-octane-js 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/definition.cjs +76 -0
- package/dist/definition.d.ts +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +19 -0
- package/package.json +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Erik Fossvold
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<div><a href="https://octanejs.dev/">Octane</a> framework definition and mount adapter for <a href="https://docs.cypress.io/app/component-testing/">component testing</a> with <a href="https://www.cypress.io/">Cypress</a></div>
|
|
2
|
+
## Installation
|
|
3
|
+
|
|
4
|
+
#### With bun
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
bun i cypress-ct-octane-js
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### With pnpm
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pnpm add cypress-ct-octane-js
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
#### With NPM
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm cypress-ct-octane-js
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage example
|
|
23
|
+
|
|
24
|
+
````
|
|
25
|
+
import { mount } from 'cypress-ct-octane-js'
|
|
26
|
+
|
|
27
|
+
it('example test', () => {
|
|
28
|
+
mount(<>Hello World!</>)
|
|
29
|
+
cy.contains('Hello World!').should('be.visible')
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
````
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cypress_1 = require("cypress");
|
|
4
|
+
const dep = {
|
|
5
|
+
// Unique, semantic identifier.
|
|
6
|
+
type: "octane-js",
|
|
7
|
+
// Human readable name.
|
|
8
|
+
name: "Octane",
|
|
9
|
+
// Package name install from `npm`.
|
|
10
|
+
package: "octane",
|
|
11
|
+
/**
|
|
12
|
+
* Similar to package, but can include a version or tag.
|
|
13
|
+
* Used during setup to generate an install command for users.
|
|
14
|
+
* Eg: `octane@next`
|
|
15
|
+
*/
|
|
16
|
+
installer: "octane@latest",
|
|
17
|
+
// Human readable description.
|
|
18
|
+
description: "Octane is a fast, JavaScript UI framework, and the successor to Inferno",
|
|
19
|
+
// Minimum supported version.
|
|
20
|
+
minVersion: "^0.1.28",
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Similar to above. Create an smooth, seamless setup experience
|
|
24
|
+
* by ensuring the user has all the necessary dependencies.
|
|
25
|
+
*/
|
|
26
|
+
const octaneVitePlugin = {
|
|
27
|
+
type: "octane-vite-plugin",
|
|
28
|
+
name: "Vite Plugin Octane",
|
|
29
|
+
package: "@octanejs/vite-plugin",
|
|
30
|
+
installer: "@octanejs/vite-plugin",
|
|
31
|
+
description: "Vite integration for Octane",
|
|
32
|
+
minVersion: "^0.1.28",
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The definition.
|
|
36
|
+
*/
|
|
37
|
+
exports.default = (0, cypress_1.defineComponentFramework)({
|
|
38
|
+
/**
|
|
39
|
+
* This should match the `npm` package name.
|
|
40
|
+
* The convention required to ensure your Definition is processed
|
|
41
|
+
* by Cypress is `cypress-ct-*` for global packages, or
|
|
42
|
+
* `@org/cypress-ct-*` for organization level packages.
|
|
43
|
+
*/
|
|
44
|
+
type: "cypress-ct-octane-js",
|
|
45
|
+
/**
|
|
46
|
+
* The label that shows up when configuring Component Testing
|
|
47
|
+
* for the first time.
|
|
48
|
+
*/
|
|
49
|
+
name: "Octane",
|
|
50
|
+
/**
|
|
51
|
+
* Supported bundlers. Can be "webpack" and/or "vite".
|
|
52
|
+
*/
|
|
53
|
+
supportedBundlers: ["vite"],
|
|
54
|
+
/**
|
|
55
|
+
* Used by Cypress to automatically detect the correct Framework Definition
|
|
56
|
+
* based on the user's project.
|
|
57
|
+
* In this example, if a module matching `dep`
|
|
58
|
+
* is found in the user's project,
|
|
59
|
+
* Octane will automatically be selected when configuring Component Testing.
|
|
60
|
+
*/
|
|
61
|
+
detectors: [dep],
|
|
62
|
+
/**
|
|
63
|
+
* Supply a set of dependencies a project should have to use this Framework Definition. The user will be prompted to install them if they are not found.
|
|
64
|
+
* Optionally, supply different dependencies based on the chosen bundler.
|
|
65
|
+
*/
|
|
66
|
+
dependencies: (bundler) => {
|
|
67
|
+
return [dep, octaneVitePlugin];
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* An SVG icon. Shown when configuring Component Testing for the first time.
|
|
71
|
+
* Optional, but good for branding your Framework Definition.
|
|
72
|
+
*/
|
|
73
|
+
icon: `
|
|
74
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 166 155.3"><path d="M163 35S110-4 69 5l-3 1c-6 2-11 5-14 9l-2 3-15 26 26 5c11 7 25 10 38 7l46 9 18-30z" fill="#76b3e1"/><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="27.5" y1="3" x2="152" y2="63.5"><stop offset=".1" stop-color="#76b3e1"/><stop offset=".3" stop-color="#dcf2fd"/><stop offset="1" stop-color="#76b3e1"/></linearGradient><path d="M163 35S110-4 69 5l-3 1c-6 2-11 5-14 9l-2 3-15 26 26 5c11 7 25 10 38 7l46 9 18-30z" opacity=".3" fill="url(#a)"/><path d="M52 35l-4 1c-17 5-22 21-13 35 10 13 31 20 48 15l62-21S92 26 52 35z" fill="#518ac8"/><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="95.8" y1="32.6" x2="74" y2="105.2"><stop offset="0" stop-color="#76b3e1"/><stop offset=".5" stop-color="#4377bb"/><stop offset="1" stop-color="#1f3b77"/></linearGradient><path d="M52 35l-4 1c-17 5-22 21npm install https://cdn.cypress.io/beta/npm/12.6.0/darwin-arm64/feature/ct-public-api-ab820f062d313fbef51665bdd1d883c69d89b3be/cypress.tgz-13 35 10 13 31 20 48 15l62-21S92 26 52 35z" opacity=".3" fill="url(#b)"/><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="18.4" y1="64.2" x2="144.3" y2="149.8"><stop offset="0" stop-color="#315aa9"/><stop offset=".5" stop-color="#518ac8"/><stop offset="1" stop-color="#315aa9"/></linearGradient><path d="M134 80a45 45 0 00-48-15L24 85 4 120l112 19 20-36c4-7 3-15-2-23z" fill="url(#c)"/><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="75.2" y1="74.5" x2="24.4" y2="260.8"><stop offset="0" stop-color="#4377bb"/><stop offset=".5" stop-color="#1a336b"/><stop offset="1" stop-color="#1a336b"/></linearGradient><path d="M114 115a45 45 0 00-48-15L4 120s53 40 94 30l3-1c17-5 23-21 13-34z" fill="url(#d)"/></svg>
|
|
75
|
+
`,
|
|
76
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getContainerEl } from "@cypress/mount-utils";
|
|
2
|
+
import { createRoot } from "octane";
|
|
3
|
+
export function mount(component, options = {}) {
|
|
4
|
+
const root = getContainerEl();
|
|
5
|
+
if (!root) {
|
|
6
|
+
throw new Error("'root' element not found");
|
|
7
|
+
}
|
|
8
|
+
createRoot(root).render(component);
|
|
9
|
+
// dispose = render(component, root);
|
|
10
|
+
return cy.wait(0, { log: false }).then(() => {
|
|
11
|
+
if (options.log !== false) {
|
|
12
|
+
Cypress.log({
|
|
13
|
+
name: "mount",
|
|
14
|
+
message: "Mounted component",
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// setupHooks(cleanup);
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cypress-ct-octane-js",
|
|
3
|
+
"version": "0.1.28",
|
|
4
|
+
"description": "Octane framework definition and mount adapter for Cypress component testing",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"types": "./dist/*.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"node": "./dist/definition.cjs",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "npm run build:definition && npm run build:mount",
|
|
15
|
+
"build:mount": "tsc --project tsconfig.mount.json",
|
|
16
|
+
"build:definition": "tsc --project tsconfig.definition.json && mv dist/definition.js dist/definition.cjs"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@cypress/mount-utils": "^4.1.2"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"cypress": "^15.20.0",
|
|
23
|
+
"octane": "^0.1.28",
|
|
24
|
+
"typescript": "^7.0.2"
|
|
25
|
+
}
|
|
26
|
+
}
|