Skip to content

Commit

Permalink
Ensure watcher snapshot is written to correct FS (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcompiles authored Aug 20, 2024
1 parent 0d6dfc8 commit c474249
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/core/core/src/RequestTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ export default class RequestTracker {
let opts = getWatcherOptions(this.options);
let snapshotPath = path.join(this.options.cacheDir, snapshotKey + '.txt');

await this.options.inputFS.writeSnapshot(
await this.options.outputFS.writeSnapshot(
this.options.watchDir,
snapshotPath,
opts,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/core/test/TargetRequest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ describe('TargetResolver', () => {
[
{
name: 'default',
distDir: '.atlaspack-cache/dist',
distDir: serveDistDir,
publicUrl: '/',
env: {
id: 'd6ea1d42532a7575',
Expand Down
3 changes: 1 addition & 2 deletions packages/core/core/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {Environment, AtlaspackOptions, Target} from '../src/types';
import {DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
import {FSCache} from '@atlaspack/cache';
import tempy from 'tempy';
import path from 'path';
import {inputFS, outputFS} from '@atlaspack/test-utils';
import {relativePath} from '@atlaspack/utils';
import {NodePackageManager} from '@atlaspack/package-manager';
Expand All @@ -17,7 +16,7 @@ export let cache: FSCache = new FSCache(outputFS, cacheDir);
cache.ensure();

export const DEFAULT_OPTIONS: AtlaspackOptions = {
cacheDir: path.join(__dirname, '.atlaspack-cache'),
cacheDir,
atlaspackVersion: '',
watchDir: __dirname,
watchIgnore: undefined,
Expand Down
13 changes: 11 additions & 2 deletions packages/core/integration-tests/test/atlaspack-query.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// @flow
import assert from 'assert';
import path from 'path';
import {bundle, describe, fsFixture, overlayFS} from '@atlaspack/test-utils';
import {
bundle,
describe,
fsFixture,
overlayFS,
inputFS,
} from '@atlaspack/test-utils';
import {loadGraphs} from '../../../dev/query/src';

describe.v2('atlaspack-query', () => {
it.skip('loadGraphs', async function () {
it('loadGraphs', async function () {
let entries = 'index.js';
let options = {
mode: 'production',
Expand All @@ -14,6 +20,9 @@ describe.v2('atlaspack-query', () => {
},
shouldDisableCache: false,
inputFS: overlayFS,
// We need to write to the default inputFS (NodeFS) as `loadGraphs` doesn't
// support custom FS's
outputFS: inputFS,
cacheDir: path.join(__dirname, '.atlaspack-cache'),
};

Expand Down
2 changes: 1 addition & 1 deletion packages/core/integration-tests/test/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -3532,7 +3532,7 @@ describe.v2('cache', function () {
assert(!res.includes('BAR'));
});

describe('pnp', function () {
describe.skip('pnp', function () {
it('should invalidate when the .pnp.js file changes', async function () {
let Module = require('module');
let origPnpVersion = process.versions.pnp;
Expand Down

0 comments on commit c474249

Please sign in to comment.