Skip to content
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

test: add integration testing #357

Merged
merged 26 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
727f946
test: add sample test
sockmaster27 Feb 20, 2024
ed5bc6d
chore: add copyright header
sockmaster27 Feb 20, 2024
fcfdbfb
test: introduce hover test
sockmaster27 Feb 21, 2024
772758b
Merge remote-tracking branch 'upstream/master' into test
sockmaster27 Feb 21, 2024
265de56
test: drop sample test
sockmaster27 Feb 21, 2024
a9eb267
test: test that value is ´Type´
sockmaster27 Feb 21, 2024
d8c48c7
refactor: remove dead import
sockmaster27 Feb 21, 2024
e395f75
doc: add info about compiler download being included in `ext.activate()`
sockmaster27 Feb 21, 2024
3571325
fix: open workspace immediately
sockmaster27 Feb 22, 2024
c5d3242
test: don't wait for compiler to start
sockmaster27 Feb 22, 2024
521b9d1
refactor: remove unused functions
sockmaster27 Feb 22, 2024
fd50909
refactor: remove `doc` and `editor` variables
sockmaster27 Feb 26, 2024
85df4ec
test: replace test file with larger example
sockmaster27 Feb 26, 2024
d536a78
test: give more expressive names
sockmaster27 Feb 26, 2024
7258415
test: make tests more fuzzy
sockmaster27 Feb 26, 2024
2bed61d
doc: document how to run tests
sockmaster27 Feb 26, 2024
837c04b
test: organize as project with dependencies
sockmaster27 Feb 26, 2024
37bdd35
chore: add new files to `.vscode-ignore`
sockmaster27 Feb 26, 2024
6cd5415
test: add more hover tests
sockmaster27 Feb 27, 2024
74b75c7
chore: use TypeScript for tests
sockmaster27 Feb 27, 2024
3ae56c6
fix: downgrade `@types/vscode`
sockmaster27 Feb 27, 2024
372628e
refactor: extend root tsconfig
sockmaster27 Feb 27, 2024
2a20fd0
chore: use lib version ES2022
sockmaster27 Feb 27, 2024
12abfa5
refactor: add types to function parameters
sockmaster27 Feb 27, 2024
b2522ef
fix: update package lock
sockmaster27 Feb 27, 2024
6592fd9
chore: increase test timeout
sockmaster27 Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { defineConfig } = require('@vscode/test-cli')

module.exports = defineConfig({
files: ['test/**/*.test.js'],
workspaceFolder: 'test/testWorkspace',

mocha: {
// Downloading compiler takes a long time
timeout: 60000,
},
})
11 changes: 9 additions & 2 deletions client/src/services/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ enum StateKeys {
installedFlixVersion = 'installedFlixVersion',
}

export function getInstalledFlixVersion(): FlixRelease {
/**
* Get the installed Flix release if one exists.
*
* In the test environment this will always return `undefined` when called the first time in a test run,
* even if an installed Flix compiler exists.
* This happens because the extension's 'Memento' is reset between each run.
*/
export function getInstalledFlixVersion(): FlixRelease | undefined {
return globalState?.get(StateKeys.installedFlixVersion)
}

export async function setInstalledFlixVersion(value) {
export async function setInstalledFlixVersion(value: FlixRelease) {
await globalState?.update(StateKeys.installedFlixVersion, value)
return openFlixReleaseOverview(value)
}
4 changes: 2 additions & 2 deletions client/src/util/ensureFlixExists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default async function ensureFlixExists({ globalStoragePath, workspaceFol
}
// 2. If `flix.jar` exists in `globalStoragePath`, use that
const filename = path.join(globalStoragePath, FLIX_JAR)
if (fs.existsSync(filename)) {
const installedFlixRelease: FlixRelease = getInstalledFlixVersion()
const installedFlixRelease = getInstalledFlixVersion()
if (fs.existsSync(filename) && installedFlixRelease) {
const thirtyMinutesInMilliseconds = 1000 * 60 * 30

// skip if we checked under 30 minutes ago
Expand Down
Loading
Loading