Skip to content

Commit

Permalink
feat: test for ignore logic
Browse files Browse the repository at this point in the history
  • Loading branch information
DOlufemi committed Jan 12, 2023
1 parent da5e25a commit 4fbe0f3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/fixtures/find-files/swift/test.build/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// swift-tools-version:5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "swift-app",

dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/grpc/grpc-swift.git", exact: "1.0.0"),

]
)
15 changes: 15 additions & 0 deletions test/tap/find-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test('find all files in test fixture', async (t) => {
path.join(testFixture, 'npm', 'package.json'),
path.join(testFixture, 'ruby', 'Gemfile.lock'),
path.join(testFixture, 'yarn', 'yarn.lock'),
path.join(testFixture, 'swift', 'test.build', 'Package.swift'),
];
const filteredOut = [
path.join(testFixture, 'golang', 'golang-app', 'Gopkg.toml'),
Expand Down Expand Up @@ -89,6 +90,7 @@ test('find all files in test fixture ignoring node_modules', async (t) => {
path.join(testFixture, 'mvn', 'pom.xml'),
path.join(testFixture, 'npm-with-lockfile', 'package-lock.json'),
path.join(testFixture, 'npm', 'package.json'),
path.join(testFixture, 'swift', 'test.build', 'Package.swift'),
path.join(testFixture, 'ruby', 'Gemfile.lock'),
path.join(testFixture, 'yarn', 'yarn.lock'),
];
Expand Down Expand Up @@ -120,6 +122,19 @@ test('find Package.swift file in test fixture ignoring .build folder', async (t)
const expected = [];
t.same(result.sort(), expected.sort(), 'should return expected file');
});
test('find Package.swift file in test fixture ignoring test.build folder', async (t) => {
const nodeModulesPath = path.join(testFixture, 'swift', 'test.build');
const { files: result } = await find(
nodeModulesPath,
[],
['Package.swift'],
6,
);
const expected = [
path.join(testFixture, 'swift', 'test.build', 'Package.swift'),
];
t.same(result.sort(), expected.sort(), 'should return expected file');
});

test('find package.json file in test fixture (by default ignoring node_modules)', async (t) => {
// six levels deep to ensure node_modules is tested
Expand Down

0 comments on commit 4fbe0f3

Please sign in to comment.