-
Notifications
You must be signed in to change notification settings - Fork 4
ci: add a test task that includes a few basic tests #2
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
Merged
+163
−0
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| push | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Lint, Build & Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| node-version: [20.x, 22.x] | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Lint code | ||
| run: | | ||
| echo "🔍 Running ESLint..." | ||
| npm run lint | ||
|
|
||
| - name: Compile TypeScript | ||
| run: | | ||
| echo "📦 Compiling TypeScript..." | ||
|
EchoPouet marked this conversation as resolved.
Outdated
|
||
| sh package.sh | ||
|
|
||
| - name: Verify compiled output exists | ||
| run: | | ||
| echo "✅ Checking compiled output..." | ||
|
EchoPouet marked this conversation as resolved.
Outdated
|
||
| if [ ! -f "out/extension.js" ]; then | ||
| echo "❌ Error: out/extension.js not found after compilation!" | ||
|
EchoPouet marked this conversation as resolved.
Outdated
|
||
| exit 1 | ||
| fi | ||
| echo "✅ Compiled output verified" | ||
|
EchoPouet marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Run tests | ||
| run: | | ||
| echo "🧪 Running test suite..." | ||
|
EchoPouet marked this conversation as resolved.
Outdated
|
||
| xvfb-run -a npm run test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import * as assert from 'assert'; | ||
| import * as vscode from 'vscode'; | ||
|
|
||
| suite('Jule Extension Test Suite', () => { | ||
| vscode.window.showInformationMessage('Start all tests.'); | ||
|
|
||
| test('Extension should be present', () => { | ||
| const ext = vscode.extensions.getExtension('julelang.jule'); | ||
| assert.ok(ext, 'Extension should be installed'); | ||
| }); | ||
|
|
||
| test('Extension should activate', async () => { | ||
| const ext = vscode.extensions.getExtension('julelang.jule'); | ||
| assert.ok(ext, 'Extension should exist'); | ||
|
|
||
| if (ext && !ext.isActive) { | ||
| await ext.activate(); | ||
| } | ||
|
|
||
| assert.ok(ext?.isActive, 'Extension should be activated'); | ||
| }); | ||
|
|
||
| test('Jule language should be registered', async () => { | ||
| const languages = await vscode.languages.getLanguages(); | ||
| assert.ok( | ||
| languages.includes('jule'), | ||
| 'Jule language should be registered' | ||
| ); | ||
| }); | ||
|
|
||
| test('Jule Module language should be registered', async () => { | ||
| const languages = await vscode.languages.getLanguages(); | ||
| assert.ok( | ||
| languages.includes('julemod'), | ||
| 'Jule Module language should be registered' | ||
| ); | ||
| }); | ||
|
|
||
| test('jule.version command should be registered', async () => { | ||
| const commands = await vscode.commands.getCommands(); | ||
| assert.ok( | ||
| commands.includes('jule.version'), | ||
| 'jule.version command should be registered' | ||
| ); | ||
| }); | ||
|
|
||
| test('.jule files should use jule language', async () => { | ||
| const languages = await vscode.languages.getLanguages(); | ||
| assert.ok( | ||
| languages.includes('jule'), | ||
| 'jule language should be available for .jule files' | ||
| ); | ||
| }); | ||
|
|
||
| test('Jule syntax highlighting should be configured', async () => { | ||
| const ext = vscode.extensions.getExtension('julelang.jule'); | ||
| const grammars = ext?.packageJSON.contributes?.grammars; | ||
|
|
||
| assert.ok(grammars, 'Grammars should be defined'); | ||
| assert.ok( | ||
| grammars.some((g: any) => g.language === 'jule'), | ||
| 'Jule grammar should be defined' | ||
| ); | ||
| }); | ||
|
|
||
| test('Module syntax highlighting should be configured', async () => { | ||
| const ext = vscode.extensions.getExtension('julelang.jule'); | ||
| const grammars = ext?.packageJSON.contributes?.grammars; | ||
|
|
||
| assert.ok(grammars, 'Grammars should be defined'); | ||
| assert.ok( | ||
| grammars.some((g: any) => g.language === 'julemod'), | ||
| 'Module grammar should be defined' | ||
| ); | ||
| }); | ||
|
|
||
| test('Snippets should be available', async () => { | ||
| const ext = vscode.extensions.getExtension('julelang.jule'); | ||
| const snippets = ext?.packageJSON.contributes?.snippets; | ||
|
|
||
| assert.ok(snippets, 'Snippets should be defined'); | ||
| assert.ok( | ||
| snippets.some((s: any) => s.language === 'jule'), | ||
| 'Jule snippets should be defined' | ||
| ); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import * as path from 'path'; | ||
| import { runTests } from '@vscode/test-electron'; | ||
|
|
||
| async function main() { | ||
| try { | ||
| // The folder containing the Extension Manifest package.json | ||
| // Passed to `--extensionDevelopmentPath` | ||
| const extensionDevelopmentPath = path.resolve(__dirname, '../../'); | ||
|
|
||
| // The path to test runner | ||
| // Passed to --extensionTestsPath | ||
| const extensionTestsPath = path.resolve(__dirname, './extension.test'); | ||
|
|
||
| // Download VS Code, unzip it and run the integration test | ||
| await runTests({ | ||
| extensionDevelopmentPath, | ||
| extensionTestsPath, | ||
| launchArgs: ['--disable-extensions'], | ||
| }); | ||
| } catch (err) { | ||
| console.error('Failed to run tests'); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| main(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.