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

fix(add): Fixes astro add modifying baseUrl by accident #10774

Merged
merged 6 commits into from
Apr 12, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: add test
Princesseuh committed Apr 12, 2024

Verified

This commit was signed with the committer’s verified signature.
theborakompanioni Thebora Kompanioni
commit ce410c5a56fe59aa105749ce5a793f0594a3d986
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files": ["i-have-base-url'"],
Princesseuh marked this conversation as resolved.
Show resolved Hide resolved
"compilerOptions": {
"baseUrl": ".",
}
}
8 changes: 8 additions & 0 deletions packages/astro/test/units/config/config-tsconfig.test.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import * as path from 'node:path';
import { describe, it } from 'node:test';
import { fileURLToPath } from 'node:url';
import { loadTSConfig, updateTSConfigForFramework } from '../../../dist/core/config/index.js';
import { readFileSync } from 'node:fs';

const cwd = fileURLToPath(new URL('../../fixtures/tsconfig-handling/', import.meta.url));

@@ -37,6 +38,13 @@ describe('TSConfig handling', () => {
assert.equal(invalidConfig, 'invalid-config');
assert.equal(missingConfig, 'missing-config');
});

it('does not change baseUrl in raw config', async () => {
const loadedConfig = await loadTSConfig(path.join(cwd, 'baseUrl'));
const rawConfig = readFileSync(path.join(cwd, 'baseUrl', 'tsconfig.json'), 'utf-8');

assert.deepEqual(loadedConfig.rawConfig, rawConfig);
});
});

describe('tsconfig / jsconfig updates', () => {