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
5 changes: 4 additions & 1 deletion clients/ember/bin/vizzly-testem-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ async function main() {

// 2. Determine failOnDiff: env var > server.json > default (false)
let failOnDiff = false;
if (process.env.VIZZLY_FAIL_ON_DIFF === 'true' || process.env.VIZZLY_FAIL_ON_DIFF === '1') {
if (
process.env.VIZZLY_FAIL_ON_DIFF === 'true' ||
process.env.VIZZLY_FAIL_ON_DIFF === '1'
) {
failOnDiff = true;
} else {
let serverInfo = getServerInfo();
Expand Down
4 changes: 3 additions & 1 deletion clients/ember/src/launcher/screenshot-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ function httpPost(url, data) {

if (res.statusCode >= 400) {
reject(
new Error(`Vizzly server error: ${res.statusCode} - ${responseBody}`)
new Error(
`Vizzly server error: ${res.statusCode} - ${responseBody}`
)
);
return;
}
Expand Down
20 changes: 14 additions & 6 deletions clients/ember/src/test-support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ function prepareTestingContainer(width = 1280, height = 720, fullPage = false) {
* @returns {boolean}
*/
function shouldFailOnDiff() {
return window.__VIZZLY_FAIL_ON_DIFF__ === true ||
window.__VIZZLY_FAIL_ON_DIFF__ === 'true';
return (
window.__VIZZLY_FAIL_ON_DIFF__ === true ||
window.__VIZZLY_FAIL_ON_DIFF__ === 'true'
);
}

/**
Expand Down Expand Up @@ -285,7 +287,9 @@ export async function vizzlyScreenshot(name, options = {}) {
// Check if this is a "no server" error - gracefully skip instead of failing
// This allows tests to pass when Vizzly isn't running (like Percy behavior)
if (errorText.includes('No Vizzly server found')) {
console.warn('[vizzly] Vizzly server not running. Skipping visual screenshot.');
console.warn(
'[vizzly] Vizzly server not running. Skipping visual screenshot.'
);
return { status: 'skipped', reason: 'no-server' };
}

Expand All @@ -302,12 +306,14 @@ export async function vizzlyScreenshot(name, options = {}) {
if (shouldFail) {
throw new VizzlyDiffError(
`Visual difference detected for '${name}' (${result.diffPercentage?.toFixed(2)}% diff). ` +
`View diff in Vizzly dashboard.`
`View diff in Vizzly dashboard.`
);
}

// Log warning but don't fail
console.warn(`[vizzly] Visual difference detected for '${name}'. View diff in Vizzly dashboard.`);
console.warn(
`[vizzly] Visual difference detected for '${name}'. View diff in Vizzly dashboard.`
);
}

return result;
Expand All @@ -320,7 +326,9 @@ export async function vizzlyScreenshot(name, options = {}) {
// Log connection errors only once to avoid spam
if (!hasLoggedConnectionError) {
hasLoggedConnectionError = true;
console.warn(`[vizzly] Screenshots skipped - server not available. Run 'vizzly tdd start' to enable.`);
console.warn(
`[vizzly] Screenshots skipped - server not available. Run 'vizzly tdd start' to enable.`
);
}
return { status: 'skipped', reason: 'error', error: error.message };
} finally {
Expand Down
29 changes: 24 additions & 5 deletions clients/ember/tests/unit/screenshot-server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ describe('screenshot-server', () => {
// (unless there's a server.json in a parent directory)
if (info !== null) {
assert.ok(typeof info.url === 'string', 'should have url');
assert.ok(typeof info.failOnDiff === 'boolean', 'should have failOnDiff');
assert.ok(
typeof info.failOnDiff === 'boolean',
'should have failOnDiff'
);
}
} finally {
process.chdir(originalCwd);
Expand Down Expand Up @@ -260,8 +263,16 @@ describe('screenshot-server', () => {
let info = getServerInfo();

assert.ok(info !== null, 'should find server.json');
assert.strictEqual(info.url, 'http://localhost:47392', 'should have correct url');
assert.strictEqual(info.failOnDiff, true, 'should read failOnDiff as true');
assert.strictEqual(
info.url,
'http://localhost:47392',
'should have correct url'
);
assert.strictEqual(
info.failOnDiff,
true,
'should read failOnDiff as true'
);
} finally {
process.chdir(originalCwd);
}
Expand All @@ -287,8 +298,16 @@ describe('screenshot-server', () => {
let info = getServerInfo();

assert.ok(info !== null, 'should find server.json');
assert.strictEqual(info.url, 'http://localhost:47393', 'should have correct url');
assert.strictEqual(info.failOnDiff, false, 'should default failOnDiff to false');
assert.strictEqual(
info.url,
'http://localhost:47393',
'should have correct url'
);
assert.strictEqual(
info.failOnDiff,
false,
'should default failOnDiff to false'
);
} finally {
process.chdir(originalCwd);
}
Expand Down
5 changes: 4 additions & 1 deletion clients/ember/tests/unit/testem-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ describe('testem-config', () => {

configure({}, {});

assert.ok(!existsSync(configPath), 'should not write empty playwright.json');
assert.ok(
!existsSync(configPath),
'should not write empty playwright.json'
);
});

it('handles lowercase browser names', () => {
Expand Down
2 changes: 1 addition & 1 deletion clients/static-site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ await run('./dist', {
viewports: 'mobile:375x667,desktop:1920x1080',
concurrency: 3,
}, {
logger: console,
output: console,
config: vizzlyConfig,
services: serviceContainer,
});
Expand Down
Loading
Loading