Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Install PlaydateSDK (Linux)
run: ./scripts/installSDKLinux.sh
if: runner.os == 'Linux'
- name: Install PlaydateSDK (Windows)
run: .\scripts\createSDKFixture.ps1
if: runner.os == 'Windows'
- name: Run tests (Linux)
run: xvfb-run -a yarn test:ci
if: runner.os == 'Linux'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- name: Install PlaydateSDK (Linux)
run: ./scripts/installSDKLinux.sh
if: runner.os == 'Linux'
- name: Install PlaydateSDK (Windows)
run: .\scripts\createSDKFixture.ps1
if: runner.os == 'Windows'
- name: Run tests (Linux)
run: xvfb-run -a yarn test:ci
if: runner.os == 'Linux'
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ mock-debug.txt
*.vsix
.DS_Store
*.pdx
fixtures/PlaydateSDK-*/*
!fixtures/PlaydateSDK-*/VERSION.txt
fixtures/PlaydateSDK/*
.nyc_output/
coverage/
tmp/
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"env": {
"PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK-1.12.3"
"PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK"
},
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"env": {
"PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK-1.12.3"
"PLAYDATE_SDK_PATH": "${workspaceFolder}/fixtures/PlaydateSDK"
},
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

The test suite selects subsets of tests to run based on the host operating system and the presence of the Playdate SDK.

To run tests against an actual Playdate SDK, copy or install the Playdate SDK to the [fixtures/PlaydateSDK-1.12.3](/fixtures/PlaydateSDK-1.12.3) directory. Tests that depend on an actual Playdate SDK will only run on macOS.
To run tests against an actual Playdate SDK, copy or install the Playdate SDK to the [fixtures/PlaydateSDK](/fixtures/PlaydateSDK) directory. Tests that depend on an actual Playdate SDK will only run on macOS.

The [`intallSDKLinux.sh`](/scripts/installSDKLinux.sh) and [`installSDKMacOS.sh`](/scripts/installSDKMacOS.sh) scripts can be used to automatically download and install the Playdate SDK in the fixtures directory on Linux and macOS, respectively.
1 change: 0 additions & 1 deletion fixtures/PlaydateSDK-1.12.3/VERSION.txt

This file was deleted.

1 change: 0 additions & 1 deletion fixtures/PlaydateSDK-1.13.0/VERSION.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"playdate-debug.sdkPath": "../../PlaydateSDK-1.12.3",
"playdate-debug.sdkPath": "../../PlaydateSDK",
"playdate-debug.sourcePath": "../basic-configuration/source",
"playdate-debug.outputPath": "./",
"playdate-debug.productName": "Override Configuration"
Expand Down
15 changes: 15 additions & 0 deletions scripts/createSDKFixture.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$fixturesDir = Join-Path $PSScriptRoot ".." "fixtures"
$sdkDir = Join-Path $fixturesDir "PlaydateSDK"

if (-not (Test-Path $sdkDir)) {
New-Item -ItemType Directory -Path $sdkDir -Force | Out-Null
Write-Host "Created directory: $sdkDir"
} else {
Write-Host "Directory already exists: $sdkDir"
}

$versionFile = Join-Path $sdkDir "VERSION.txt"
$semverVersion = "3.0.0"

Set-Content -Path $versionFile -Value $semverVersion
Write-Host "Created VERSION.txt with version: $semverVersion"
6 changes: 4 additions & 2 deletions scripts/installSDKLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ set -euxo pipefail
mkdir tmp
cd tmp

wget https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-1.12.3.tar.gz
tar xfz PlaydateSDK-1.12.3.tar.gz -C ../fixtures/
wget https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-latest.tar.gz
rm -rf ../fixtures/PlaydateSDK
mkdir ../fixtures/PlaydateSDK
tar --strip-components 1 -xzf PlaydateSDK-latest.tar.gz -C ../fixtures/PlaydateSDK/
6 changes: 3 additions & 3 deletions scripts/installSDKMacOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euxo pipefail

VERSION=${1:-1.12.3}
VERSION=${1:-latest}
PLAYDATE_SDK=PlaydateSDK-${VERSION}

rm -rf tmp/${VERSION}
Expand All @@ -20,5 +20,5 @@ fi
mkdir out
xar -xf "${PKG_FILE}" -C out
cat out/PlaydateSDK.pkg/Payload | gunzip -dc | cpio -i
rm -rf ../../fixtures/${PLAYDATE_SDK}
mv PlaydateSDK ../../fixtures/${PLAYDATE_SDK}
rm -rf ../../fixtures/PlaydateSDK
mv PlaydateSDK ../../fixtures/PlaydateSDK
4 changes: 2 additions & 2 deletions src/test/suite/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ suite("Configuration Test Suite", () => {

assert.ok(sdkPath);
assert.ok(path.isAbsolute(sdkPath));
assert.ok(sdkPath.endsWith(path.join("/fixtures/PlaydateSDK-1.12.3")));
assert.ok(sdkPath.endsWith(path.join("/fixtures/PlaydateSDK")));

assert.strictEqual(sdkVersion, "1.12.3");
assert.match(sdkVersion, /^\d+\.\d+\.\d+$/);

assert.ok(path.isAbsolute(sourcePath));
assert.ok(
Expand Down
59 changes: 28 additions & 31 deletions src/test/suite/pdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
withSDK,
waitForFileToExist,
getFixtureWorkspaceFolder,
skipCI,
} from "./suiteTestUtils";

suite("PDC Test Suite", () => {
Expand Down Expand Up @@ -71,35 +70,33 @@ suite("PDC Test Suite", () => {

test(
"pdc-configuration",
withSDK(
skipCI(async () => {
const fixture = "pdc-configuration";
const index = 2;

const tasks = await vscode.tasks.fetchTasks({ type: TaskType.pdc });
assert.strictEqual(tasks.length, 3);
assertTaskFixture(tasks[0], "basic-configuration");
assertTaskFixture(tasks[1], "override-configuration");
assertTaskFixture(tasks[index], fixture);

const { sourcePath } = await resolveConfig(fixture);
const originalPDXInfo = await readPDXInfo(sourcePath);
assert.strictEqual(originalPDXInfo.buildNumber, "1");

await runTask(tasks[index]);

const pdxPath = path.resolve(
getFixturePath(fixture),
"PDC Configuration.pdx",
);
await waitForFileToExist(pdxPath);

const pdxInfo = await readPDXInfo(sourcePath);
assert.strictEqual(pdxInfo.buildNumber, "2");

await cleanPDXBundles();
await writePDXInfo(originalPDXInfo, sourcePath);
}),
),
withSDK(async () => {
const fixture = "pdc-configuration";
const index = 2;

const tasks = await vscode.tasks.fetchTasks({ type: TaskType.pdc });
assert.strictEqual(tasks.length, 3);
assertTaskFixture(tasks[0], "basic-configuration");
assertTaskFixture(tasks[1], "override-configuration");
assertTaskFixture(tasks[index], fixture);

const { sourcePath } = await resolveConfig(fixture);
const originalPDXInfo = await readPDXInfo(sourcePath);
assert.strictEqual(originalPDXInfo.buildNumber, "1");

await runTask(tasks[index]);

const pdxPath = path.resolve(
getFixturePath(fixture),
"PDC Configuration.pdx",
);
await waitForFileToExist(pdxPath);

const pdxInfo = await readPDXInfo(sourcePath);
assert.strictEqual(pdxInfo.buildNumber, "2");

await cleanPDXBundles();
await writePDXInfo(originalPDXInfo, sourcePath);
}),
);
});
2 changes: 1 addition & 1 deletion src/test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function getBaseFixturesPath(): string {

export function getPlaydateSDKFixturePath(): string {
const baseFixturesPath = getBaseFixturesPath();
return path.resolve(baseFixturesPath, "PlaydateSDK-1.12.3");
return path.resolve(baseFixturesPath, "PlaydateSDK");
}

export function getWorkspaceFixturesPath(): string {
Expand Down