Skip to content

Commit

Permalink
Update tests (pt. 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Aug 21, 2024
1 parent 1bf0894 commit 241e189
Show file tree
Hide file tree
Showing 46 changed files with 4,332 additions and 884 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ jobs:
- name: Run compiler
run: yarn compile
- name: Run `extenion build` command
run: yarn test:build
run: EXTENSION_ENV=development yarn test:build

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Core Plugin
on: push
jobs:
build:
Expand All @@ -9,5 +9,5 @@ jobs:
run: yarn
- name: Run compiler
run: yarn compile
- name: Run tests
- name: Run core webpack plugin tests
run: yarn test
31 changes: 0 additions & 31 deletions aaa.sh

This file was deleted.

990 changes: 990 additions & 0 deletions examples/action-chatgpt/yarn.lock

Large diffs are not rendered by default.

2,434 changes: 2,434 additions & 0 deletions examples/content-extension-config/yarn.lock

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions examples/content-preact/babel.config.json

This file was deleted.

165 changes: 89 additions & 76 deletions examples/data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DevOptions } from 'extension-develop'
import {DevOptions} from 'extension-develop'
import {type Template} from './types'

const DEFAULT_TEMPLATE: Template = {
Expand Down Expand Up @@ -30,20 +30,20 @@ const JS_TEMPLATES: Template[] = [
// hasEnv: false,
// configFiles: ['babel.config.json']
// },
// {
// name: 'content-extension-config',
// uiContext: ['content'],
// uiFramework: 'react',
// css: 'css',
// hasBackground: true,
// hasEnv: false,
// configFiles: [
// 'extension.config.js',
// 'tsconfig.json',
// 'postcss.config.js',
// 'tailwind.config.js'
// ]
// },
{
name: 'content-extension-config',
uiContext: ['content'],
uiFramework: 'react',
css: 'css',
hasBackground: true,
hasEnv: false,
configFiles: [
'extension.config.js',
'tsconfig.json',
'postcss.config.js',
'tailwind.config.js'
]
},
{
name: 'config-stylelint',
uiContext: ['newTab'],
Expand Down Expand Up @@ -214,15 +214,15 @@ const TS_TEMPLATES: Template[] = [
]

const CUSTOM_TEMPLATES: Template[] = [
// {
// name: 'action-chatgpt',
// uiContext: ['action'],
// uiFramework: 'react',
// css: 'css',
// hasBackground: false,
// hasEnv: true,
// configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
// }
{
name: 'action-chatgpt',
uiContext: ['action'],
uiFramework: 'react',
css: 'css',
hasBackground: false,
hasEnv: true,
configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
}
]

const FRAMEWORK_TEMPLATES: Template[] = [
Expand All @@ -235,33 +235,33 @@ const FRAMEWORK_TEMPLATES: Template[] = [
hasEnv: false,
configFiles: ['tsconfig.json']
},
// {
// name: 'content-react',
// uiContext: ['content'],
// uiFramework: 'react',
// css: 'css',
// hasBackground: false,
// hasEnv: false,
// configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
// },
// {
// name: 'new-preact',
// uiContext: ['newTab'],
// uiFramework: 'preact',
// css: 'css',
// hasBackground: false,
// hasEnv: false,
// configFiles: ['tsconfig.json']
// },
// {
// name: 'content-preact',
// uiContext: ['content'],
// uiFramework: 'preact',
// css: 'css',
// hasBackground: false,
// hasEnv: false,
// configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
// },
{
name: 'content-react',
uiContext: ['content'],
uiFramework: 'react',
css: 'css',
hasBackground: false,
hasEnv: false,
configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
},
{
name: 'new-preact',
uiContext: ['newTab'],
uiFramework: 'preact',
css: 'css',
hasBackground: false,
hasEnv: false,
configFiles: ['tsconfig.json']
},
{
name: 'content-preact',
uiContext: ['content'],
uiFramework: 'preact',
css: 'css',
hasBackground: false,
hasEnv: false,
configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
},
{
name: 'new-vue',
uiContext: ['newTab'],
Expand All @@ -270,40 +270,49 @@ const FRAMEWORK_TEMPLATES: Template[] = [
hasBackground: false,
hasEnv: false,
configFiles: ['tsconfig.json']
},
{
name: 'content-vue',
uiContext: ['content'],
uiFramework: 'vue',
css: 'css',
hasBackground: false,
hasEnv: false,
configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
}
// {
// name: 'content-vue',
// uiContext: ['content'],
// uiFramework: 'vue',
// css: 'css',
// hasBackground: false,
// hasEnv: false,
// configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
// }
]

const TAILWIND_TEMPLATES: Template[] = [
{
name: 'content-tailwind',
uiContext: ['content'],
uiFramework: undefined,
css: 'css',
hasBackground: false,
hasEnv: false,
configFiles: ['tailwind.config.js', 'postcss.config.js', 'tsconfig.json']
},
{
name: 'new-tailwind',
uiContext: ['newTab'],
uiFramework: 'react',
css: 'css',
hasBackground: false,
hasEnv: false,
configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
}
]

const ALL_TEMPLATES: Template[] = [
// {
// name: 'content-tailwind',
// uiContext: ['newTab'],
// uiFramework: undefined,
// css: 'css',
// hasBackground: false,
// hasEnv: false,
// configFiles: ['tailwind.config.js', 'postcss.config.js', 'tsconfig.json']
// },
// {
// name: 'new-tailwind',
// uiContext: ['newTab'],
// uiFramework: 'react',
// name: 'content-vue',
// uiContext: ['content'],
// uiFramework: 'vue',
// css: 'css',
// hasBackground: false,
// hasEnv: false,
// configFiles: ['postcss.config.js', 'tailwind.config.js', 'tsconfig.json']
// }
]

const ALL_TEMPLATES: Template[] = [
DEFAULT_TEMPLATE,
...JS_TEMPLATES,
...WASM_TEMPLATES,
Expand All @@ -317,7 +326,11 @@ const ALL_TEMPLATES_BUT_DEFAULT = ALL_TEMPLATES.filter(
(template) => template.name !== 'init'
)

const SUPPORTED_BROWSERS: DevOptions['browser'][] = ['chrome', 'edge', 'firefox']
const SUPPORTED_BROWSERS: DevOptions['browser'][] = [
'chrome',
'edge',
'firefox'
]

export {
SUPPORTED_BROWSERS,
Expand Down
11 changes: 0 additions & 11 deletions examples/new-preact/babel.config.json

This file was deleted.

1 change: 1 addition & 0 deletions examples/special-folders-pages/pages/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<body>
<h1>Main Window</h1>
<p>I am the main window. I am not sandboxed.</p>
<img src="../images/notpublic-file.png" alt="Not Public File" />
<iframe src="../sandbox/index.html" width="380" height="140"></iframe>
<iframe src="/public/html/file.html" width="380" height="140"></iframe>
<script src="./main.js"></script>
Expand Down
3 changes: 3 additions & 0 deletions examples/special-folders-pages/sandbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="utf-8" />
<title>Sandboxed Content</title>
<link rel="stylesheet" href="../public/css/file.css" />
<link rel="stylesheet" href="./styles.css" />
</head>
<body>
<h1>Sandboxed Content</h1>
Expand All @@ -16,6 +17,8 @@ <h1>Sandboxed Content</h1>
"output of an eval-ed inline script.</p>'"
);
</script>
<iframe src="../pages/custom.html"></iframe>
<script src="./scripts.js"></script>
<script src="../public/js/file.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions programs/cli/__spec__/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {promisify} from 'util'
const execAsync = promisify(exec)

export async function extensionProgram(command: string = '') {
const cliDir = path.resolve(__dirname, '..', 'dist', 'cli.js')
const cliCommand = `node ${cliDir} ${command}`
const cliDirectory = path.resolve(__dirname, '..', 'dist', 'cli.js')
const cliCommand = `node ${cliDirectory} ${command}`
return await execAsync(cliCommand)

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium test

This shell command depends on an uncontrolled
absolute path
.
}

Expand Down
3 changes: 1 addition & 2 deletions programs/cli/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/__spec__/**/*.spec.ts']
testEnvironment: 'node'
}
Loading

0 comments on commit 241e189

Please sign in to comment.