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
1 change: 0 additions & 1 deletion .env.example

This file was deleted.

6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Build project
run: pnpm build

- name: Run tests
run: pnpm test

- name: Run lint
run: pnpm lint

- name: dotenv-diff scan
run: npx dotenv-diff
50 changes: 50 additions & 0 deletions test/e2e/cli.autoscan.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,54 @@ describe('no-flag autoscan', () => {
);
expect(res.stdout).toContain('[high]');
});

it('will ingore files with excludeFiles option in config', () => {
const cwd = tmpDir();

fs.writeFileSync(
path.join(cwd, 'dotenv-diff.config.json'),
JSON.stringify(
{
excludeFiles: ['src/ignore/**'],
},
null,
2,
),
);

fs.mkdirSync(path.join(cwd, 'src', 'ignore'), { recursive: true });
fs.writeFileSync(
path.join(cwd, 'src', 'ignore', 'index.ts'),
`const secret = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";`,
);

const res = runCli(cwd, []);
expect(res.status).toBe(0);
expect(res.stdout).not.toContain('Potential secrets detected in codebase');
});

it('excludes a single file using exclude option', () => {
const cwd = tmpDir();

fs.writeFileSync(
path.join(cwd, 'dotenv-diff.config.json'),
JSON.stringify(
{
exclude: ['src/secret.ts'],
},
null,
2,
),
);

fs.mkdirSync(path.join(cwd, 'src'), { recursive: true });
fs.writeFileSync(
path.join(cwd, 'src', 'secret.ts'),
`const secret = "sk_live_123456789";`,
);

const res = runCli(cwd, []);
expect(res.stdout).not.toContain('Potential secrets detected in codebase');
expect(res.status).toBe(0);
});
});
Loading