Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Use npm test instead of trying to sniff for qunit in gruntfiles #216

Open
westonruter opened this issue Feb 24, 2017 · 0 comments
Open

Use npm test instead of trying to sniff for qunit in gruntfiles #216

westonruter opened this issue Feb 24, 2017 · 0 comments

Comments

@westonruter
Copy link
Contributor

See todo in

wp-dev-lib/check-diff.sh

Lines 762 to 800 in 2e18d4e

# @todo: This is wrong, as we should be doing `npm test` instead of calling `grunt qunit` directly.
function run_qunit {
if [ ! -s "$TEMP_DIRECTORY/paths-scope-js" ] || ! check_should_execute 'grunt'; then
return
fi
find $PATH_INCLUDES -name Gruntfile.js > "$TEMP_DIRECTORY/gruntfiles"
if [ ! -z "$PATH_EXCLUDES_PATTERN" ]; then
cat "$TEMP_DIRECTORY/gruntfiles" | grep -E -v "$PATH_EXCLUDES_PATTERN" | cat - > "$TEMP_DIRECTORY/excluded-gruntfiles"
mv "$TEMP_DIRECTORY/excluded-gruntfiles" "$TEMP_DIRECTORY/gruntfiles"
fi
if [ ! -s "$TEMP_DIRECTORY/gruntfiles" ]; then
return
fi
for gruntfile in $( cat "$TEMP_DIRECTORY/gruntfiles" ); do
if ! grep -Eqs 'grunt\.loadNpmTasks.*grunt-contrib-qunit' "$gruntfile"; then
continue
fi
echo "Gruntfile: $gruntfile"
# @todo Skip if there the CHECK_SCOPE is limited, and the dirname($gruntfile) is not among paths-scope-js; make sure root works
cd "$( dirname "$gruntfile" )"
# Make sure Node packages are installed in this location. Ignore symlink.
if [ -e package.json ] && [ ! -e node_modules -o -h node_modules ]; then
npm install
fi
if [ -e "$(npm bin)/grunt" ]; then
$(npm bin)/grunt qunit
else
grunt qunit
fi
cd - /dev/null
done
}

For nested projects, should they use $( ls node_modules | wc -l ) == 0 like in #215?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant